package com.kommii.test;

import java.util.Date;
import java.util.List;

import com.hddf.project.auth.pojos.User;
import com.hddf.project.auth.service.MongoDB_Query;
import com.hddf.project.auth.service.MongoDB_Sync;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;

public class test3 {

	public static void main(String[] args) {
		MongoDB_Query mq = MongoDB_Query.getInstance();
		MongoDB_Sync ms = MongoDB_Sync.getInstance();
		List<DBObject> list = mq.getUserList("0", "10", -1);
		//DBObject obj = mq.getUserByWebToken("4369a0d0-b9ff-4b1c-bcb4-2a77214eee67");
		DBObject obj = mq.getDBObjectUserById(1);
		
		//prik_map
		User  u = mq.getUserById(1);
		/*System.out.println(u.getPermission());
		System.out.println(u.getUsername());
		System.out.println(obj);*/
		//u.setUser_no("9091b0f9ad367");
		//ms.updateUser(u);
 		/*System.out.println(obj.get("_id"));
		System.out.println(obj.get("username"));
		System.out.println(obj.get("user_no"));
		System.out.println(obj.get("permission"));
		System.out.println(obj.get("last_login_date"));*/
		/*int s = list.size();
		DBObject obj = null;
		System.out.println(s);
		for(int i=0;i<s;i++){
			obj = list.get(i);
			System.out.println(obj.get("_id"));
			System.out.println(obj.get("username"));
		}*/
		obj = new BasicDBObject();
		//obj.put("_id", "53d1d40b0cf22092a8258f58");
		obj.put("user_no", "9091b0f9ad371");
		obj.put("user_id", 1);
		Date date = new Date();
		obj.put("username", "zhbgreat");
		obj.put("password","e10adc3949ba59abbe56e057f20f883e" );
		obj.put("permission","all");
		obj.put("register_date",date);
		obj.put("last_login_date", date);
		obj.put("department","管理员");
		obj.put("description", "超级管理员");
		obj.put("mobile_phone","15856985501");
		obj.put("isopen",1);
       
		obj.put("web_token", "");
		obj.put("webtoken_lifetime",0);
		obj.put("app_token", "");
		obj.put("apptoken_lifetime",0);
		obj.put("pubk", "");
		obj.put("prik_map",null);
		obj.put("aes_key", "");
		//obj.put("user_no", "9091b0f9ad366");
		ms.updateUser(obj);

	}

}
